//
//  MainMyViewController.m
//  Jyxt
//
//  Created by 刘日 on 17/5/10.
//  Copyright © 2017年 DaLian Rental Housing Management. All rights reserved.
//

#import "MainMyViewController.h"
#import "MixViewController.h"
#import "UserCenterViewModel.h"
#import "DatabaseTool.h"
#import "MsgViewModel.h"
@interface MainMyViewController ()

@end

@implementation MainMyViewController


- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.lkNavigationBar.hidden = YES;
    [MsgViewModel getUnreadMsgInfoWhenSuccess:^(NSInteger count, NSString *info) {
        if (count == 0) {
            self.messageCountLabel.hidden = YES;
        }else{
            self.messageCountLabel.hidden = NO;
            self.messageCountLabel.text = [NSString stringWithFormat:@"%ld",count];

        }
    } failed:^(NSString *reason) {
        NSLog(@"REASON %@" , reason);
    }];
}

- (void)initView{
    self.nameLabel.text = [DatabaseTool getWithKey: @"uName"];
    self.changePasswordView.onTap = ^(UIView *view){
        MIX_OPEN(HTML_USER_CENTER_CHANGE_PASSWORD);
    };
    self.platformMessageView.onTap = ^(UIView *view){
        MIX_OPEN(HTML_MESSAGE_PLATFORM);
    };
}

- (UIStatusBarStyle)preferredStatusBarStyle {
    return UIStatusBarStyleDefault;
}

- (IBAction)signOutButtonTouch:(UIButton *)sender {
    [UserCenterViewModel signOut];
}

@end
